﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="HL.Lib.MVC.CPViewControl" %>
<% 
    var model = ViewBag.Model as MMapLocationModel;
    var entity = ViewBag.Data as MMapLocationEntity;
%>
<style>
    .condition input[type='text']
    {
        height: 21px;
        width: 134px;
        font-size: 17px;
        padding-top: 4px;
        text-align: right;
    }
</style>
<form id="hlForm" name="hlForm" method="post">
<input type="hidden" id="_hl_action" name="_hl_action" />
<div id="toolbar-box">
    <div class="t">
        <div class="t">
            <div class="t">
            </div>
        </div>
    </div>
    <div class="m">
        <div class="toolbar-list" id="toolbar">
            <%= GetDefaultAddCommand()%>
        </div>
        <div class="pagetitle icon-48-article">
            <h2>
                Bản đồ :
                <%=  model.RecordID > 0 ? "Chỉnh sửa" : "Thêm mới"%>
            </h2>
        </div>
        <div class="clr">
        </div>
    </div>
    <div class="b">
        <div class="b">
            <div class="b">
            </div>
        </div>
    </div>
</div>
<div class="clr">
</div>
<%= ShowMessage()%>
<script type="text/javascript">
    window.addEvent('domready', function () { new Accordion($$('div#content-sliders-.pane-sliders > .panel > h3.pane-toggler'), $$('div#content-sliders-.pane-sliders > .panel > div.pane-slider'), { onActive: function (toggler, i) { toggler.addClass('pane-toggler-down'); toggler.removeClass('pane-toggler'); i.addClass('pane-down'); i.removeClass('pane-hide'); Cookie.write('jpanesliders_content-sliders-', $$('div#content-sliders-.pane-sliders > .panel > h3').indexOf(toggler)); }, onBackground: function (toggler, i) { toggler.addClass('pane-toggler'); toggler.removeClass('pane-toggler-down'); i.addClass('pane-hide'); i.removeClass('pane-down'); if ($$('div#content-sliders-.pane-sliders > .panel > h3').length == $$('div#content-sliders-.pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_content-sliders-', -1); }, duration: 300, opacity: false, alwaysHide: true }); });
</script>
<%if (true)
  { %>
<script type="text/javascript">
    document.switcher = null;
    window.addEvent('domready', function () {
        toggler = document.id('submenu');
        element = document.id('tab-document1');
        if (element) {
            document.switcher = new JSwitcher(toggler, element, { cookieName: "app1" });
        }
    });
</script>
<%} %>
<script language="javascript" type="text/javascript">
    var priceRank = [];
   priceRank=<%= Utils.PriceRank() %>;
   
   function SetPriceRank(obj){
   var priceText=document.getElementById("PriceValue").value;
   if(priceText.length<1)
        priceText="0";
        priceText+='';
    var price=parseFloat(priceText.replace(/,/g,""));
    var PriceIndex=0;
 for(var i=0;i<priceRank.length;i++){
 var item=priceRank[i];
        var PriceFrom=parseFloat(item.PriceFrom);
        var PriceTo=parseFloat(item.PriceTo);
        if(PriceFrom<=price && price<=PriceTo){
        PriceIndex=item.Index;
         document.getElementById("cboPrice").selectedIndex =i;
           document.getElementById("cboPrice2").selectedIndex =i;
            break;
        }    
    }
  //  console.log(document.getElementById("cboPrice").selectedIndex);
   // document.getElementById("cboPrice").value = PriceIndex;
   //$('IdOfInput').value = PriceIndex;

 //  document.getElementById("PriceValue").value=FormatPrice(priceText);
   }

  window.addEvent('domready', function() {
  SetPriceRank();
  $('PriceValue').addEvent('keyup',function(e){
  SetPriceRank(this);
  return true;
  });
$('PriceValue').addEvent('keydown',function(e){
    if ((e.code >= 48 && e.code <= 57 )||(e.code  >= 96 && e.code  <= 105)||  e.code == 8   ||  e.code == 9||  e.code == 13      ||  e.code == 46){
        return true;
    }

    

    e.stop();
    return false;
});
});

function FormatPrice(price) {
    var result = '';
    var i = 1;
    var length = price.toString().length;
    for (var len = length - 1; len >= 0; len--) {
        if ((i == 3 || i == 6 || i == 9) && i != length)
            result += price.toString().charAt(len) + ',';
        else result += price.toString().charAt(len);
        i++;
    }
    price = result;
    length = result.toString().length;
    result = '';
    for (var len1 = length - 1; len1 >= 0; len1--)
        result += price.toString().charAt(len1);
    return result;
}

</script>
<div id="submenu-box">
    <div class="t">
        <div class="t">
            <div class="t">
            </div>
        </div>
    </div>
    <div class="m">
        <div class="submenu-box">
            <div class="submenu-pad">
                <ul id="submenu" class="configuration">
                    <li><a id="tab2" class="active">Bài viết</a></li>
                </ul>
                <div class="clr">
                </div>
            </div>
        </div>
        <div class="clr">
        </div>
        <div class="clr">
        </div>
    </div>
    <div class="b">
        <div class="b">
            <div class="b">
            </div>
        </div>
    </div>
</div>
<div id="tab-document1" class="col width-100">
    <div id="page-tab2" class="tab">
        <div id="element-box">
            <div class="t">
                <div class="t">
                    <div class="t">
                    </div>
                </div>
            </div>
            <div class="m">
                <div class="width-70 fltlft">
                    <fieldset class="adminform">
                        <legend>THÔNG TIN CHUNG</legend>
                        <table class="admintable">
                            <tr>
                                <td class="key">
                                    <label>
                                        Tiêu đề :</label>
                                </td>
                                <td>
                                    <input class="text_input" type="text" name="Tittle" value="<%=entity.Tittle %>" maxlength="200" />
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Địa chỉ :</label>
                                </td>
                                <td>
                                    <input class="text_input" type="text" name="Address" value="<%=entity.Address %>"
                                        maxlength="200" />
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Hình ảnh :</label>
                                </td>
                                <td>
                                    <%if (!string.IsNullOrEmpty(entity.ImgUrl))
                                      { %>
                                    <%= Utils.GetMedia(entity.ImgUrl, 100, 80, string.Empty, true, "id='img_view2'")%><%}
                                      else
                                      { %>
                                    <img id="img_view2" width="100" height="80" />
                                    <%} %>
                                    <br />
                                    <input class="text_input" type="text" name="ImgUrl" id="ImgUrl" style="width: 65%"
                                        value="<%=entity.ImgUrl %>" />
                                    <input class="text_input" style="width: 75px;" type="button" onclick="ShowFileForm('ImgUrl');return false;"
                                        value="Chọn ảnh" />
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Tóm tắt :</label>
                                </td>
                                <td colspan="2" class="content">
     <%--                               <textarea class="text_input" style="height: 50px; width: 98%" name="Intro"><%=entity.Intro %></textarea>--%>

                                    <textarea class="ckeditor" style="width: 150px; height: 50px" name="Intro" id="Textarea1"><%=entity.Intro%></textarea>

                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Nội dung :</label>
                                </td>
                                <td colspan="2" class="content">
                            <%--        <textarea class="text_input" style="height: 100px; width: 98%" name="Content"><%=entity.Content %></textarea>--%>

                                     <textarea class="ckeditor" style="width: 150px; height: 98%" name="Content" id="Content"><%=entity.Content%></textarea>

                                </td>
                            </tr>
                        </table>
                    </fieldset>
                </div>
                <div class="width-30 fltrt">
                    <div id="content-sliders-" class="pane-sliders">
                        <div class="panel">
                            <h3 class="pane-toggler title" id="publishing-details">
                                <a href="javascript:void(0);"><span>THUỘC TÍNH</span></a></h3>
                            <div class="pane-slider content">
                                <table class="admintable condition">
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Danh mục
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <select name="Catalogue" id="Catalogue" class="text_input">
                                                <%=Utils.GetSelectCatalogue(entity.Catalogue) %>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Tỉnh/Thành phố
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <select name="City" id="City" class="text_input">
                                                <%=Utils.GetSelectCity(entity.City) %>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Giá dịch vụ
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <table>
                                                <tr>
                                                    <td>
                                                        Giá:
                                                    </td>
                                                    <td>
                                                        <input name="PriceValue" id="PriceValue" type="text" class="text_input" value="<% =entity.PriceValue %>" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        Mức giá:
                                                    </td>
                                                    <td>
                                                        <select name="Price" style="display: none" id="cboPrice" class="text_input">
                                                            <%=Utils.GetSelectPrice(entity.Price) %>
                                                        </select>
                                                        <select name="Price2" id="cboPrice2" disabled="disabled" class="text_input">
                                                            <%=Utils.GetSelectPrice(entity.Price) %>
                                                        </select>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Vị trí
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <table>
                                                <tr>
                                                    <td>
                                                        Kinh độ:
                                                    </td>
                                                    <td>
                                                        <input name="Longtitude" type="text" value="<% =entity.Longtitude %>" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        Vĩ độ:
                                                    </td>
                                                    <td>
                                                        <input name="Lattitude" type="text" value="<% =entity.Lattitude %>" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clr">
                </div>
            </div>
            <div class="b">
                <div class="b">
                    <div class="b">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/{CPPath}/Content/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
    CKFinder.setupCKEditor(null, '/{CPPath}/Content/ckfinder/');

    function refreshPage(arg) {
        arg = '~' + arg;
        document.getElementById(name_control).value = arg;
        if (name_control == 'ImgUrl') {

            if (document.getElementById("img_view2"))
                document.getElementById("img_view2").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'PromotionText') {
            if (document.getElementById("PromotionText_i"))
                document.getElementById("PromotionText_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'Menu') {
            if (document.getElementById("Menu_i"))
                document.getElementById("Menu_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'Services') {
            if (document.getElementById("Services_i"))
                document.getElementById("Services_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'Map') {
            if (document.getElementById("Map_i"))
                document.getElementById("Map_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
    }

   
</script>
<%--<script type="text/javascript">
    var obj = document.getElementById('pt');
    function showp(value) {
        if (value == "1") obj.style.display = 'block'; else obj.style.display = 'none'
    }
    if ('<%=entity.Promotion %>' == 'True') {
        showp(1);
    }
</script>--%>
</form>
